package com.dzm.Test05.utils;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * 作者：Dzm
 * 时间：2024-07-26-19:43
 * 功能：
 */

public class DBUtil {
    private static String driver = "com.mysql.cj.jdbc.Driver";
    private static String url = "jdbc:mysql:///chaoshi?serverTimeZone=Asia/Shanghai";
    private static String username = "root";
    private static String password = "123456";

    //初始化
    static {
        try {
            Class.forName(driver);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public static Connection getConnect() throws SQLException {
        return DriverManager.getConnection(url, username, password);
    }

}
